package com.winter.service.impl;

import com.winter.mapper.TopicInfoMapper;
import com.winter.mapper.TopicMapper;
import com.winter.model.Topic;
import com.winter.model.TopicInfo;
import com.winter.service.TopicInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TopicInfoServiceImpl implements TopicInfoService {
    @Autowired
    private TopicInfoMapper topicInfoMapper;
    @Autowired
    private TopicMapper topicMapper;


    //查询所有问题
    public List<Topic> findAllTopic(Map<String,Object> paramMap){
        List<Topic> list =topicMapper.findAllTopic(paramMap);
        return list;
    }
    //查询所有枪手问题
    public List<TopicInfo> findAllGunManTopic(Map<String,Object> paramMap){
        Long gnnManId =(long)paramMap.get("userId");
        List<TopicInfo> list =topicInfoMapper.findAllGunManTopic(gnnManId);
        return list;


    }
    //查询所有提问者的问题
    public List<TopicInfo> findAllUserTopic(Map<String,Object> paramMap){
        Long userId =(long)paramMap.get("userId");
        List<TopicInfo> list =topicInfoMapper.findAllUserTopic(userId);
        return list;

    }


    public int findAllUserTopicCount(long userId){
        return topicInfoMapper.findAllUserTopicCount(userId);
    }
    //查询枪手完结问题的数量
    public int findAllGunManFinishTopicCount(long gunManId){
     return topicInfoMapper.findAllGunManFinishTopicCount(gunManId);

    }

    //查询所有提问者的问题 草稿count
    public int findAllUserTopicPaperCount(long userId){
         return topicInfoMapper.findAllUserTopicPaperCount(userId);
    }
    //查询所有枪手的正在进行解决问题数量  count
    public int findAllGunManDoingTopicCount(long gunManId){
        return topicInfoMapper.findAllGunManDoingTopicCount(gunManId);
    }

}
